﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Interface_Sample_DotNet
{
    class WinPropAPI
    {
        /* ********* WinProp_Model_DPM ***********************************/
        #region WinProp_Model_DPM
        /* 
        typedef struct {
            double  DiffrLoss;                  
            double  ExponentLOS;                
            double  ExponentOLOS;               
            double  ExponentNLOS;               
            double  ExponentLOSafterBP;         
            double  ExponentOLOSafterBP;       
            int     Waveguiding;                
            double  WG_Weighting;               
            double  WG_MaxDistance;             
            int     AdaptiveResolution;         
            double  Offset_LOS_Pixels;          
            double  Offset_NonLOS_Pixels;       
            double  BuildingLossPerMeter;       
            unsigned char   ConsiderFloorsBuildings;  
            unsigned char   ConsiderFloorsTrxBuilding;
	        int     IntDummy1;
	        int     IntDummy2;
	        int     IntDummy3;
	        double  DoubleDummy1;
	        double  DoubleDummy2;
	        double  DoubleDummy3;
        } WinProp_Model_DPM;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Model_DPM
        {
            public double DiffrLoss;
            public double ExponentLOS;
            public double ExponentOLOS;
            public double ExponentNLOS;
            public double ExponentLOSafterBP;
            public double ExponentOLOSafterBP;
            public int Waveguiding;
            public double WG_Weighting;
            public double WG_MaxDistance;
            public int AdaptiveResolution;
            public double Offset_LOS_Pixels;
            public double Offset_NonLOS_Pixels;
            public double BuildingLossPerMeter;
            public byte ConsiderFloorsBuildings;
            public byte ConsiderFloorsTrxBuilding;
            public int IntDummy1;
            public int IntDummy2;
            public int IntDummy3;
            public double DoubleDummy1;
            public double DoubleDummy2;
            public double DoubleDummy3;
        }
        #endregion
        /* ********* WinProp_Model_DPM ***********************************/

        /* ********* WinProp_MeasurementPoint ***********************************/
        #region WinProp_MeasurementPoint
        /* 
        typedef struct WinProp_MeasurementPoint {
            double              LocationX;
            double              LocationY;
            double              SignalLevel;
            double              PredictionLevel;
            int                 ClutterClassID;
            int                 StateLOS;
            unsigned int        PixelX;
            unsigned int        PixelY;
            int                 Int1;
            int                 Int2;
            double              Double1;
            double              Double2;
        }   WinProp_MeasurementPoint;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_MeasurementPoint
        {
            public double LocationX;
            public double LocationY;
            public double SignalLevel;
            public double PredictionLevel;
            public int ClutterClassID;
            public int StateLOS;
            public uint PixelX;
            public uint PixelY;
            public int Int1;
            public int Int2;
            public double Double1;
            public double Double2;
        }
        #endregion
        /* ********* WinProp_MeasurementPoint ***********************************/

        /* ********* WinProp_Measurement ***********************************/
        #region WinProp_Measurement
        /* 
        typedef struct {
            unsigned int        NrMeasurements;         
            char                MeasurementFile[300];
            WinProp_MeasurementPoint    *Points;
        } WinProp_Measurement;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Measurement
        {
            public uint NrMeasurements;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string MeasurementFile;
            public IntPtr Points;
        }
        #endregion
        /* ********* WinProp_Measurement ***********************************/

        /* ********* WinProp_Converter ***********************************/
        #region WinProp_Converter
        /* 
        typedef struct {
            int			ConverterID;            
	        char		*databaseNameSource;    
	        char		*databaseNameDest;      
	        char		*measurementUnit;		
            char		**ignoreList;           
	        int			nbrElements;            
	        float		scalingFactor;          
        } WinProp_Converter;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Converter
        {
            public int ConverterID;
            [MarshalAs(UnmanagedType.LPStr)]
            public string databaseNameSource;
            [MarshalAs(UnmanagedType.LPStr)]
            public string databaseNameDest;
            [MarshalAs(UnmanagedType.LPStr)]
            public string measurementUnit;
            public IntPtr ignoreList;
            public int nbrElements;
            public float scalingFactor;
        }
        #endregion
        /* ********* WinProp_Converter ***********************************/

        /* ********* WinProp_INTERFACE_CORNER ***********************************/
        #region WinProp_INTERFACE_CORNER
        /* 
        typedef struct {
            double		x;   
            double      y;   
            double      z;   
        } INTERFACE_CORNER;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_INTERFACE_CORNER
        {
            public double GainHorizontal;
            public double Gain3D;
            public double Phase3D;
        }
        #endregion
        /* ********* WinProp_INTERFACE_CORNER ***********************************/

        /* ********* WinProp_INTERFACE_MATERIAL ***********************************/
        #region WinProp_INTERFACE_MATERIAL
        /* 
        typedef struct {
            int     buildingType;
            int     materialID;                                     
            float   thickness;                                      
            float   epsilon;
            float   mu;
            float   sigma;
            float   transWall;                                      
            float   transRoof;                                      
            float   reflexion;                                      
            float   diffInMin;
            float   diffInMax;
            float   diffOut;
            int     shapeLength;                                   
            char    shapeName[255];                                 
            char    commentText[256];
        } INTERFACE_CORNER;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_INTERFACE_MATERIAL
        {
            public int buildingType;
            public int materialID;
            public float thickness;
            public float epsilon;
            public float mu;
            public float sigma;
            public float transWall;
            public float transRoof;
            public float reflexion;
            public float diffInMin;
            public float diffInMax;
            public float diffOut;
            public int shapeLength;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
            public string shapeName;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
            public string commentText;
        }
        #endregion
        /* ********* WinProp_INTERFACE_MATERIAL ***********************************/

        /* ********* WinProp_URBAN_BUILDING ***********************************/
        #region WinProp_URBAN_BUILDING
        /* 
        typedef struct {
            int                 ID;                                 
            int                 nbrCorners;                        
            INTERFACE_CORNER*   corners;                          
            INTERFACE_MATERIAL* material;                          
            URBAN_BUILDING* next;                              
        } URBAN_BUILDING;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_URBAN_BUILDING
        {
            public int ID;
            public int nbrCorners;
            public IntPtr corners;
            public IntPtr next;
        }
        #endregion
        /* ********* WinProp_URBAN_BUILDING ***********************************/

        /* ********* WinProp_URBAN_BUILDINGS ***********************************/
        #region WinProp_URBAN_BUILDINGS
        /* 
        typedef struct {
            double lowerLeftX;                         
            double lowerLeftY;
            double upperRightX;                     
            double upperRightY;
            double minBuildingHeight;                 
            double parameter;                          
            int nbrBuildings;                       
            int maxNbrCorners;                      
            URBAN_BUILDING* buildingData;
        } URBAN_BUILDINGS;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_URBAN_BUILDINGS
        {
            public double lowerLeftX;
            public double lowerLeftY;
            public double upperRightX;
            public double upperRightY;
            public double minBuildingHeight;
            public double parameter;
            public int nbrBuildings;
            public int maxNbrCorners;
            public IntPtr buildingData;
        }
        #endregion
        /* ********* WinProp_URBAN_BUILDINGS ***********************************/

        /* ********* WinProp_TOPOGRAPHY ***********************************/
        #region WinProp_TOPOGRAPHY
        /* 
        typedef struct {
            double			resolutionX;
            double			resolutionY;
            double			lowerLeftX;
            double			lowerLeftY;
            double			upperRightX; 
            double			upperRightY;
            unsigned int	columns;
            unsigned int	rows;
            int				coordDatum;				            
            int             coordEllipsoid;                     
            int             coordGeoUTM;                        
            int             coordUTMZone;                       
            bool            coordUTMNorth;                     
            float**         heights;
        } TOPOGRAPHY;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_TOPOGRAPHY
        {
            public double resolutionX;
            public double resolutionY;
            public double lowerLeftX;
            public double lowerLeftY;
            public double upperRightX;
            public double upperRightY;
            public uint columns;
            public uint rows;
            public int coordDatum;
            public int coordEllipsoid;
            public int coordGeoUTM;
            public int coordUTMZone;
            public bool coordUTMNorth;
            public IntPtr heights;
        }
        #endregion
        /* ********* WinProp_TOPOGRAPHY ***********************************/

        /* ********* WinProp_FREQUENCY_LOSS ***********************************/
        #region WinProp_FREQUENCY_LOSS
        /* 
        typedef struct {
            float Frequency_MHz;                      
            float Loss_dB;                            
            float Dielectricity;                      
            float Permeability;                       
            float Conductivity;                       
        } FREQUENCY_LOSS;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_FREQUENCY_LOSS
        {
            public float Frequency_MHz;
            public float Loss_dB;
            public float Dielectricity;
            public float Permeability;
            public float Conductivity;
        }
        #endregion
        /* ********* WinProp_FREQUENCY_LOSS ***********************************/

        /* ********* WinProp_CLUTTER_CLASS ***********************************/
        #region WinProp_CLUTTER_CLASS
        /* 
        typedef struct {
            char        name[CLUTTER_CLASS_NAME_LENGTH];
            int         hataClass;                          
            int         ID;                                 
            int         NrAttenuation;                      
            FREQUENCY_LOSS* Attenuation;                       
            float       heightMean;                        
            float       heightStdDev;                      
            float       clearanceMin;                    
            float       clearanceMax;                     
            float       clearanceRatio;                   
            float       clearanceFree;                     
            int         isVegetation;                     
            float       MeanOffset;                        
            int         PixelCount;                        
            unsigned char colorRed;
            unsigned char colorGreen;
            unsigned char colorBlue;
            float float1;                            
            float float2;
            int int1;                       
            int int2;                             
        } CLUTTER_CLASS;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_CLUTTER_CLASS
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 400)]
            public string name;
            public int hataClass;
            public int ID;
            public int NrAttenuation;
            public IntPtr Attenuation;
            public float heightMean;
            public float heightStdDev;
            public float clearanceMin;
            public float clearanceMax;
            public float clearanceRatio;
            public float clearanceFree;
            public int isVegetation;
            public float MeanOffset;
            public int PixelCount;
            public byte colorRed;
            public byte colorGreen;
            public byte colorBlue;
            public float float1;
            public float float2;
            public int int1;
            public int int2;
        }
        #endregion
        /* ********* WinProp_CLUTTER_CLASS ***********************************/

        /* ********* WinProp_CLUTTER ***********************************/
        #region WinProp_CLUTTER
        /* 
        typedef struct {
            unsigned int columns;                            
            unsigned int rows;                               
            double resolutionX;                        
            double resolutionY;                        
            double lowerLeftX;                         
            double lowerLeftY;                        
            double upperRightX;                        
            double upperRightY;                       
            int**  clutterData;                     
            int    nbrClasses;                        
            CLUTTER_CLASS* classes;                           
        } CLUTTER;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_CLUTTER
        {
            public uint columns;
            public uint rows;
            public double resolutionX;
            public double resolutionY;
            public double lowerLeftX;
            public double lowerLeftY;
            public double upperRightX;
            public double upperRightY;
            public IntPtr clutterData;
            public int nbrClasses;
            public IntPtr classes;
        }
        #endregion
        /* ********* WinProp_CLUTTER ***********************************/

        /* ********* WinProp_ParaMain ***********************************/
        #region WinProp_ParaMain
        /* 
        typedef struct {
	        unsigned int	ScenarioMode;			
            unsigned int    PredictionModelUrban;   
            unsigned int    PredictionModelRural;  
            unsigned int    PredictionLargeArea;  
             
            double          UrbanLowerLeftX;    
            double          UrbanLowerLeftY;    
            double          UrbanUpperRightX;        
            double          UrbanUpperRightY; 
                   
            double          RuralLowerLeftX;
            double          RuralLowerLeftY;
            double          RuralUpperRightX;
            double          RuralUpperRightY;

            unsigned int    MatrixFormat;           
            unsigned int    MatrixHeight;           
            unsigned int    MatrixWidth;            
            double          Resolution;              
            double          PredictionHeight;        

            double          VectorRadius;           

            int             BreakpointMode;         
            double          BreakpointFactor;        
            double          BreakpointOffset;       
            double          BreakpointDistance;
            
            unsigned int    BuildingsMode;         
            double          BuildingHeights;        
            int             BuildingHeightsAbs;   
            int             BuildingsMaterialsInd;  
            double          BuildingsTransmissionLoss;
            URBAN_BUILDINGS Buildings;              
            char            BuildingsName[300];        
            unsigned int    BuildingsIndoorCoverage;

            unsigned int    TopographyMode;
            TOPOGRAPHY      Topography;              
            char            TopographyName[300];
            int             TopographyHeightMode;
            
            unsigned int    ClutterMode;           
            unsigned int    ClutterConsideration;
            int             ClutterReceiverLocation;
            int             ClutterCalibration;
            CLUTTER         Clutter;               
            char            ClutterName[300];
            
            unsigned int    VegetationMode;
            char            VegetationName[300];
            int             VegetationPropertiesInd;
            double          VegetationLossFixed;
            double          VegetationLossPerMeter;

            unsigned int    BuildingsPixelMode;
            TOPOGRAPHY      BuildingsPixel;
            char            BuildingsPixelName[300];
            int             BuildingsPixelHeightMode;
            double          BuildingsPixelHeightTolerance;

            unsigned int    AdditionalResultMode;
            char            AdditionalResult[300];
            
            double          Offset;
            unsigned int    DistributedPrediction;
            
            unsigned int    Filter;                 
            unsigned int    FilterOrder;            
            unsigned int    FilterMode;            

            unsigned int    UseAntennaLimit;
            double          AntennaLimit;

            char            ErrorMessageMain[MAX_ERROR_LEN];
            char            ErrorMessageSub[MAX_ERROR_LEN];
            int             SupressMessageBoxes;
            int             ModeAPI;
            
            int             MaxNumberRaysUsed;
            int             MaxNumberRays;
            int             IndoorPredictionOnly;
            double          ValueNotComputed;
            double          BuildingsIndoorDecrease;
            double          Dummy3;
        } WinProp_ParaMain;
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_ParaMain
        {
            public uint ScenarioMode;
            public uint PredictionModelUrban;
            public uint PredictionModelRural;
            public uint PredictionLargeArea;

            public double UrbanLowerLeftX;
            public double UrbanLowerLeftY;
            public double UrbanUpperRightX;
            public double UrbanUpperRightY;

            public double RuralLowerLeftX;
            public double RuralLowerLeftY;
            public double RuralUpperRightX;
            public double RuralUpperRightY;

            public uint MatrixFormat;
            public uint MatrixHeight;
            public uint MatrixWidth;
            public double Resolution;
            public double PredictionHeight;

            public double VectorRadius;

            public int BreakpointMode;
            public double BreakpointFactor;
            public double BreakpointOffset;
            public double BreakpointDistance;

            public uint BuildingsMode;
            public double BuildingHeights;
            public int BuildingHeightsAbs;
            public int BuildingsMaterialsInd;
            public double BuildingsTransmissionLoss;
            public WinProp_URBAN_BUILDINGS Buildings;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string BuildingsName;
            public uint BuildingsIndoorCoverage;

            public uint TopographyMode;
            public WinProp_TOPOGRAPHY Topography;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string TopographyName;
            public int TopographyHeightMode;

            public uint ClutterMode;
            public uint ClutterConsideration;
            public int ClutterReceiverLocation;
            public int ClutterCalibration;
            public WinProp_CLUTTER Clutter;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string ClutterName;

            public uint VegetationMode;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string VegetationName;
            int VegetationPropertiesInd;
            double VegetationLossFixed;
            double VegetationLossPerMeter;

            public uint BuildingsPixelMode;
            public WinProp_TOPOGRAPHY BuildingsPixel;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string BuildingsPixelName;
            public int BuildingsPixelHeightMode;
            public double BuildingsPixelHeightTolerance;

            public uint AdditionalResultMode;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string AdditionalResult;

            public double Offset;
            public uint DistributedPrediction;

            public uint Filter;
            public uint FilterOrder;
            public uint FilterMode;

            public uint UseAntennaLimit;
            public double AntennaLimit;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string ErrorMessageMain;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
            public string ErrorMessageSub;
            public int SupressMessageBoxes;
            public int ModeAPI;

            public int MaxNumberRaysUsed;
            public int MaxNumberRays;
            public int IndoorPredictionOnly;
            public double ValueNotComputed;
            public double BuildingsIndoorDecrease;
            public double Dummy3;
        }
        #endregion
        /* ********* WinProp_ParaMain ***********************************/



        /* ********* WinProp_Scenario **********************************/
        #region WinProp_Scenario

        /* The class WinProp_Scenario covers the following structure used */
        /* in the WinProp API. The following codes describes the structure */
        /* in plain C code.

        typedef struct WinProp_Scenario {
            int     Scenario;
            char    *VectorDatabase;
            char    *PixelBldDatabase;
            char    *TopographyDatabase;
            char    *ClutterDatabase;
            char    *ClutterTable;
            int     VectorDatabaseSorting;
        }   WinProp_Scenario;       
    
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Scenario
        {
            public int Scenario;
            [MarshalAs(UnmanagedType.LPStr)]
            public string VectorDatabase;
            [MarshalAs(UnmanagedType.LPStr)]
            public string PixelBldDatabase;
            [MarshalAs(UnmanagedType.LPStr)]
            public string TopographyDatabase;
            [MarshalAs(UnmanagedType.LPStr)]
            public string ClutterDatabase;
            [MarshalAs(UnmanagedType.LPStr)]
            public string ClutterTable;
            public int VectorDatabaseSorting;
        }

        #endregion
        /* ********* WinProp_Scenario **********************************/


        /* ********* WinProp_Callback **********************************/
        #region WinProp_Callback

        /* The class WinProp_Callback covers the following structure used */
        /* in the WinProp API. The following codes describes the structure */
        /* in plain C code.

        typedef struct WinProp_Callback {
            CALLBACK_PERCENTAGE     Percentage;
            CALLBACK_MESSAGE        Message;
            CALLBACK_ERROR          Error;

        }   WinProp_Callback;        

        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Callback
        {
            public ProgressCallBackPtr Percentage;
            public MessageCallBackPtr Message;
            public ErrorCallBackPtr Error;
        }
        public delegate int ProgressCallBackPtr(int progress, string text);
        public delegate int MessageCallBackPtr(string text);
        public delegate int ErrorCallBackPtr(string text, int number);

        #endregion
        /* ********* WinProp_Callback **********************************/


        /* ********* WinProp_Pattern ***********************************/
        #region WinProp_Pattern

        /* The class WinProp_Callback covers the following structure used */
        /* in the WinProp API. The following codes describes the structure */
        /* in plain C code.

        typedef struct {
            int     Mode;
            char    *Filename;      
            int     NrVertical;     
            double  *AnglesVertical;
            double  *GainVertical;
            int     NrHorizontal;   
            double  *AnglesHorizontal;
            double  *GainHorizontal;
            double  **Gain3D;         
            double  **Phase3D;        
        }   WinProp_Pattern;      

        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Pattern
        {
            public int Mode; //modify "int Mode" to "public int Mode"
            [MarshalAs(UnmanagedType.LPStr)]
            public string Filename;
            public int NrVertical;
            public IntPtr AnglesVertical;
            public IntPtr GainVertical;
            public int NrHorizontal;
            public IntPtr AnglesHorizontal;
            public IntPtr GainHorizontal;
            public IntPtr Gain3D;
            public IntPtr Phase3D;
        }

        #endregion
        /* ********* WinProp_Pattern ***********************************/


        /* ********* WinProp_Antenna ***********************************/
        #region WinProp_Antenna

        /* The class WinProp_Antenna covers the following structure used */
        /* in the WinProp API. The following codes describes the structure */
        /* in plain C code.

        typedef struct {
            int     Enabled;        
            double  Longitude_X;    
            double  Latitude_Y;     
            double  Height;         
            int     Model;          
            int     DataType;       
            int     DataMode;       
            int     Carrier;        
            double  Power;          
            int     PowerMode;      
            double  Frequency;      
            double  Azimuth;        
            double  Downtilt;       
            int     Type;           
            double  Gain;           
            WinProp_Pattern *Pattern; 
            WinProp_Pattern *PatternPolHoriz;
            char    *Name;          
            int     NbrCableSegs;   
            COORDPOINT   *CablePoints;   
            double  CableLossPer100m; 
            double  CouplingLoss;   
            double  DistCouplingLoss; 
            int     RepeaterStatus;  
            int     RepeaterIndex;   
            int     SystemID;        
            int     HeightAbsolute;  
        }   WinProp_Antenna;

        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Antenna
        {
            public int Enabled;
            public double Longitude_X;
            public double Latitude_Y;
            public double Height;
            public int Model;
            public int DataType;
            public int DataMode;
            public int Carrier;
            public double Power;
            public int PowerMode;
            public double Frequency;
            public double Azimuth;
            public double Downtilt;
            public int Type;
            public double Gain;
            public IntPtr Pattern;
            public IntPtr PatternPolHoriz;
            [MarshalAs(UnmanagedType.LPStr)]
            public string Name;
            public int NbrCableSegs;
            public IntPtr CablePoints;
            public double CableLossPer100m;
            public double CouplingLoss;
            public double DistCouplingLoss;
            public int RepeaterStatus;
            public int RepeaterIndex;
            public int SystemID;
            public int HeightAbsolute;
            public int MimoID;
        }

        #endregion
        /* ********* WinProp_Antenna ***********************************/


        /* ********* WinProp_Area **************************************/
        #region WinProp_Area

        /* The class WinProp_Area covers the following structure used */
        /* in the WinProp API. The following codes describes the structure */
        /* in plain C code.

        typedef struct WinProp_Area {
            double  LowerLeftX;
            double  LowerLeftY;
            double  UpperRightX;
            double  UpperRightY;
            double  Resolution;
            int     NrHeights;
            double  *Heights;
            void    *CoordSystem;
        }   WinProp_Area;

        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Area
        {
            public double LowerLeftX;
            public double LowerLeftY;
            public double UpperRightX;
            public double UpperRightY;
            public double Resolution;
            public int NrHeights;
            public IntPtr Heights;
            public IntPtr CoordSystem;
        }

        #endregion
        /* ********* WinProp_Area **************************************/


        /* ********* WinProp_Result*************************************/
        #region WinProp_Result

        /* The class WinProp_Result covers the following structure used */
        /* in the WinProp API. The following codes describes the structure */
        /* in plain C code.

        typedef struct WinProp_Result {
            int     DataType;       
            int     DataTransmissionMode;
            double  Resolution;     
            double  LowerLeftX;     
            double  LowerLeftY;     
            int     NrHeights;      
            double  *Heights;       
            int     Columns;        
            int     Lines;          
            float   ***Matrix;      
            double  Tx_Power;       
            double  Frequency;      
            void    *CoordSystem;	
        }   WinProp_Result;
        
        */

        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        public struct WinProp_Result
        {
            public int DataType;
            public int DataTransmissionMode;
            public double Resolution;
            public double LowerLeftX;
            public double LowerLeftY;
            public int NrHeights;
            public IntPtr Heights;
            public int Columns;
            public int Lines;
            public IntPtr Matrix;
            public double Tx_Power;
            public double Frequency;
            public IntPtr CoordSystem;
        }

        #endregion
        /* ********* WinProp_Result*************************************/


        /* ********* Import functions from Engine.dll ******************/
        /* PLEASE SET THE PATHS TO THE CORRECT FOLDER ON YOUR PC!!!!   */
        #region ImportFunctions

        /* The following code imports the function InterfaceClutterFree() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceClutterFree@@YAXPEAUCLUTTER@@@Z")]
        public static extern void InterfaceClutterFree(
            ref WinProp_CLUTTER Clutter
            );

        /* The following code imports the function InterfaceLoadClutterASC() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceLoadClutterASC@@YAHPEAUCLUTTER@@PEAD1@Z")]
        public static extern void InterfaceLoadClutterASC(
            ref WinProp_CLUTTER Clutter,
            string FilenameDatabase,
            string FilenameCluttertable
            );

        /* The following code imports the function InterfaceLoadClutterMSI() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceLoadClutterMSI@@YAHPEAUCLUTTER@@PEAD1@Z")]
        public static extern void InterfaceLoadClutterMSI(
            ref WinProp_CLUTTER Clutter,
            string FilenameDatabase,
            string FilenameCluttertable
            );

        /* The following code imports the function InterfaceTopoFree() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceTopoFree@@YAXPEAUTOPOGRAPHY@@@Z")]
        public static extern void InterfaceTopoFree(
            ref WinProp_TOPOGRAPHY Topo
            );

        /* The following code imports the function InterfaceLoadTopoASC() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceLoadTopoASC@@YAHPEAUTOPOGRAPHY@@PEAD@Z")]
        public static extern void InterfaceLoadTopoASC(
            ref WinProp_TOPOGRAPHY Topo,
            string Filename
            );

        /* The following code imports the function InterfaceLoadTopoMSI() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceLoadTopoMSI@@YAHPEAUTOPOGRAPHY@@PEAD@Z")]
        public static extern void InterfaceLoadTopoMSI(
            ref WinProp_TOPOGRAPHY Topo,
            string Filename
            );

        /* The following code imports the function InterfaceLoadBuildingsAircomSingleFile() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceLoadBuildingsAircomSingleFile@@YAXPEAUURBAN_BUILDINGS@@PEAD1@Z")]
        public static extern void InterfaceLoadBuildingsAircomSingleFile(
            ref WinProp_URBAN_BUILDINGS Buildings,
            string FilenameBuildings,
            string FilenameAttributes
            );

        /* The following code imports the function InterfaceLoadBuildingsASCII() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceLoadBuildingsASCII@@YAXPEAUURBAN_BUILDINGS@@PEAD@Z")]
        public static extern void InterfaceLoadBuildingsASCII(
            ref WinProp_URBAN_BUILDINGS Buildings,
            string Filename
            );

        /* The following code imports the function InterfaceBuildingsFree() from */
        /* "InterMan.dll" */

        [DllImport("InterMan.dll", EntryPoint = "?InterfaceBuildingsFree@@YAXPEAUURBAN_BUILDINGS@@@Z")]
        public static extern void InterfaceBuildingsFree(
            ref WinProp_URBAN_BUILDINGS Buildings
            );

        /* The following code imports the function WinProp_Structure_Init_ParameterMain() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_ParameterMain")]
        public static extern int WinProp_Structure_Init_ParameterMain(
            ref WinProp_ParaMain ParameterUrban
            );

        /* The following code imports the function WinProp_Structure_Init_Model_DPM() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_Model_DPM")]
        public static extern int WinProp_Structure_Init_Model_DPM(
            ref WinProp_Model_DPM ParameterDPM
            );

        /* The following code imports the function WinProp_Structure_Init_Antenna() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_Antenna")]
        public static extern int WinProp_Structure_Init_Antenna(
            ref WinProp_Antenna ParameterAntenna
            );

        /* Add on Feb 13, 2018 by JJL*/
        /* The following code imports the function WinProp_Structure_Init_Pattern() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_Pattern")]
        public static extern int WinProp_Structure_Init_Pattern(
            ref WinProp_Pattern ParameterPattern
            );

        /* The following code imports the function WinProp_Structure_Init_Result() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_Result")]
        public static extern int WinProp_Structure_Init_Result(
            ref WinProp_Result Resultmatrix
            );

        /* The following code imports the function WinProp_Structure_Init_Measurement() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_Measurement")]
        public static extern int WinProp_Structure_Init_Measurement(
            ref WinProp_Measurement Para
            );

        /* The following code imports the function WinProp_Structure_Init_MeasurementPoint() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Structure_Init_MeasurementPoint")]
        public static extern int WinProp_Structure_Init_MeasurementPoint(
            ref WinProp_MeasurementPoint Point
            );

        /* The following code imports the function WinProp_Convert() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Convert")]
        public static extern int WinProp_Convert(
            ref WinProp_Converter Converter,
            ref WinProp_Callback Callback
            );

        /* The following code imports the function OutdoorPlugIn_ComputePrediction() from */
        /* "Engine.dll" */

        //[DllImport("Engine.dll", EntryPoint = "OutdoorPlugIn_ComputePrediction")]
        //public static extern int OutdoorPlugIn_ComputePrediction(
        //    ref WinProp_Antenna  ParameterAntenna,
        //    ref WinProp_ParaMain ParameterUrban,
        //    ref WinProp_Model_DPM ParameterDPM,
        //    /*ref WinProp_Measurement*/IntPtr ParameterMeasurements,
        //    IntPtr               ParameterRural,
        //    IntPtr               ParameterCNP,
        //    ref WinProp_Callback Callback,
        //    ref WinProp_Result   Resultmatrix,
        //    IntPtr               Anglematrix,
        //    IntPtr               LOSmatrix
        //    );

        /* The following code imports the function OutdoorPlugIn_ComputePrediction() from */
        /* "Engine.dll" */

        //[DllImport("Engine.dll", EntryPoint = "OutdoorPlugIn_ComputePrediction")]
        //public static extern int OutdoorPlugIn_ComputePrediction(
        //    ref WinProp_Antenna ParameterAntenna,
        //    ref WinProp_ParaMain ParameterUrban,
        //    IntPtr ParameterModelUrban,
        //    IntPtr ParameterMeasurements,
        //    IntPtr ParameterRural,
        //    IntPtr ParameterCNP,
        //    ref WinProp_Callback Callback,
        //    ref WinProp_Result Resultmatrix,
        //    IntPtr Anglematrix,
        //    IntPtr LOSmatrix
        //    );

        /* The following code imports the function OutdoorPlugIn_ComputePrediction() from */

        /* "Engine.dll" */



        [DllImport("Engine.dll", EntryPoint = "OutdoorPlugIn_ComputePrediction")]

        public static extern int OutdoorPlugIn_ComputePrediction(

            ref WinProp_Antenna ParameterAntenna,

            ref WinProp_ParaMain ParameterUrban,

            ref WinProp_Model_DPM ParameterDPM,

            /*ref WinProp_Measurement*/IntPtr ParameterMeasurements,

            IntPtr ParameterRural,

            IntPtr ParameterCNP,

            ref WinProp_Callback Callback,

            ref WinProp_Result Resultmatrix,

            IntPtr Anglematrix,

            IntPtr LOSmatrix

            );

        /* The following code imports the function WinProp_Open() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Open")]
        public static extern int WinProp_Open(
            ref int DataID,
            ref WinProp_Scenario Scenario,
            ref WinProp_Callback Callback
            );


        /* The following code imports the function WinProp_Predict() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Predict")]
        public static extern int WinProp_Predict(
            int DataID,
            ref WinProp_Antenna Antenna,
            ref WinProp_Area Area,
            IntPtr ModelSettings,
            IntPtr Additional,
            IntPtr ResultCoverage,
            IntPtr ResultDelay,
            IntPtr ResultNatureOfPath,
            IntPtr ResultRays,
            IntPtr Measurements
            );


        /* The following code imports the function WinProp_Close() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_Close")]
        public static extern int WinProp_Close(
            int DataID
            );


        /* The following code imports the function WinProp_CopyResult() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_CopyResult")]
        public static extern int WinProp_CopyResult(
            ref WinProp_Result Dest,
            ref WinProp_Result Source
            );


        /* The following code imports the function WinProp_FreeResult() from */
        /* "Engine.dll" */

        [DllImport("Engine.dll", EntryPoint = "WinProp_FreeResult")]
        public static extern int WinProp_FreeResult(
            ref WinProp_Result Result
            );


        /* The following code imports the function WinProp_Net_Project_Open() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_Project_Open")]
        public static extern int WinProp_Net_Project_Open(
            ref int DataID,
            uint IN_AirInterface,
            IntPtr CallbackPtr
            );


        /* The following code imports the function WinProp_Net_Project_Close() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_Project_Close")]
        public static extern int WinProp_Net_Project_Close(
            int DataID
            );


        /* The following code imports the function WinProp_Net_Project_Para_Get() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_Project_Para_Get")]
        public static extern int WinProp_Net_Project_Para_Get(
            int DataID,
            int Parameter,
            IntPtr ReturnDouble,
            IntPtr ReturnInt,
            IntPtr ReturnChar
            );


        /* The following code imports the function WinProp_Net_Project_Para_Set() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_Project_Para_Set")]
        public static extern int WinProp_Net_Project_Para_Set(
            int DataID,
            int Parameter,
            IntPtr InDouble,
            IntPtr InInt,
            IntPtr InChar
            );


        /* The following code imports the function WinProp_Net_Project_Compute() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_Project_Compute")]
        public static extern int WinProp_Net_Project_Compute(
            int DataID,
            ref WinProp_Callback Callback
            );


        /* The following code imports the function WinProp_Net_PropagationMap_Add() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_PropagationMap_Add")]
        public static extern int WinProp_Net_PropagationMap_Add(
            int DataID,
            ref int ReturnMapIndex,
            ref WinProp_Antenna Antenna,
            ref WinProp_Result PropagationMap
            );


        /* The following code imports the function WinProp_Net_NetworkMap_Get() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_NetworkMap_Get")]
        public static extern int WinProp_Net_NetworkMap_Get(
            int DataID,
            int Service,
            int ResultType,
            IntPtr ResultMap
            );


        /* The following code imports the function WinProp_Net_Carrier_Add() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_Carrier_Add")]
        public static extern int WinProp_Net_Carrier_Add(
            int DataID,
            double FrequencyUL,
            double FrequencyDL,
            uint CarrierIndex
            );


        /* The following code imports the function WinProp_Net_TransmissionMode_Add() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_TransmissionMode_Add")]
        public static extern int WinProp_Net_TransmissionMode_Add(
            int DataID,
            string ModeName,
            uint Index
            );


        /* The following code imports the function WinProp_Net_TransmissionMode_Para_Get() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_TransmissionMode_Para_Get")]
        public static extern int WinProp_Net_TransmissionMode_Para_Get(
            int DataID,
            int Index,
            int Parameter,
            IntPtr ReturnDouble,
            IntPtr ReturnInt,
            IntPtr ReturnChar
            );


        /* The following code imports the function WinProp_Net_TransmissionMode_Para_Set() from */
        /* "Engine Net.dll" */

        [DllImport("Engine Net.dll", EntryPoint = "WinProp_Net_TransmissionMode_Para_Set")]
        public static extern int WinProp_Net_TransmissionMode_Para_Set(
            int DataID,
            int Index,
            int Parameter,
            IntPtr ReturnDouble,
            IntPtr ReturnInt,
            IntPtr ReturnChar
            );


        #endregion
        /* ********* Import functions from Engine.dll ******************/
    }
}


